/*  This file is part of YATracker.
    YATracker is free software: you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
    YATracker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with
YATracker. If not, see <http://www.gnu.org/licenses/>. */

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLabel>
#include <QDateTime>
#include "qmapwidget.h"
#include "yatmapfile.h"


/////////////////////////////////////////////////////////////////////////////
// Alert functions implemented in main.cpp

void alertInfo(const QString &message);
void alertWarn(const QString &message);


/////////////////////////////////////////////////////////////////////////////


class YatMapFile;
class QGpsSource;

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

public:
    void restoreSettings();

public slots:
    void gpsStartStop();
    void centerMapToSpot();
    void followSpot();
    void editPreferences();
    void gpsMessageRMC(double latitude, double longitude);
    void gpsMessageGSA(int fix, float pdop, float hdop, float vdop, int fixSats);
    void gpsMessageGGA(int fix, double latitude, double longitude, int fixSats);

protected:
    void changeEvent(QEvent *e);
    void closeEvent(QCloseEvent *);
    void updateGpsStatus();

private:
    Ui::MainWindow *ui;
    YatMapFile m_yatmapfile;
    QGpsSource *m_gps;
    QDateTime m_lasttimedatareceived;
    QLabel m_statusLabelInfo;
    bool m_followspot;

private:
    QMapWidget* m_MapWidget;
};

#endif // MAINWINDOW_H
